package com.tc168.cp306.b06.activity;

import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;

import com.tc168.cp306.b06.R;

public class NavButtomActivity extends AppCompatActivity {

    private DrawerLayout mDlNavButtom;
    private Toolbar mToolbar;
    private ActionBarDrawerToggle mActionBarDrawerToggle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_nav_buttom_toolbar);
        initView();
    }

    private void initView() {
        mToolbar = (Toolbar) findViewById(R.id.tb_nav_buttom);
        mToolbar.setTitle("抽屉不遮挡 Toolbar");//设置标题
//        mToolbar.setTitleTextColor(getResources().getColor(R.color.colorAccent));//标题颜色
        setSupportActionBar(mToolbar);

        mDlNavButtom = (DrawerLayout) findViewById(R.id.dl_nav_buttom);
        mActionBarDrawerToggle = new ActionBarDrawerToggle(this, mDlNavButtom, mToolbar, 0, 0);
        mDlNavButtom.addDrawerListener(mActionBarDrawerToggle);
        mActionBarDrawerToggle.syncState();//ActionBarDrawerToggle与DrawerLayout的状态同步，
        // 并将ActionBarDrawerToggle中的drawer图标，设置为ActionBar的Home-Button的icon
    }
}
